import {createApp} from "vue";
import App from "./App.vue";
import "./assets/css/common.css";
import {createRouter, createWebHistory} from "vue-router";

// 导入页面组件
import Home from "./views/Home.vue";
import Login from "./views/Login.vue";
import UserManagement from "./views/UserManagement.vue";
import UserProfile from "./views/UserProfile.vue";
import NotFound from "./views/NotFound.vue";

// 创建路由器
const router = createRouter({
    history: createWebHistory(),
    routes: [
        // 设置主页面
        {path: "/", redirect: "/home"},
        {path: "/home", component: Home},
        {path: "/login", component: Login},
        {path: "/users", component: UserManagement},
        {path: "/userData", component: UserProfile},
        // 兜底路由 - 处理404情况
        {path: '/:pathMatch(.*)*', component: NotFound, name: 'NotFound'}


    ],
});

// 加载路由
let app = createApp(App);
app.use(router);
app.mount("#app");
